﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CSMSys.Lib.BusinessObjects;
using CSMSys.Lib.DataAccessLayer.Implementations;
using CSMSys.Lib.Manager.INV;
using CSMSys.Lib.Model;

namespace CSMSys.Lib.Manager.Reports
{
    public class ServiceReportManager
    {
        #region Properties
        public LoanDAOLinq _LoanDaoLinq;
        public SRVRegistrationDAOLinq _SrvRegistrationDaoLinq;
        #endregion

        #region Constructor
        public ServiceReportManager()
        {
            _LoanDaoLinq = new LoanDAOLinq();
            _SrvRegistrationDaoLinq = new SRVRegistrationDAOLinq();   
        }
        #endregion
        public float retLoanDisbursed(int serialid)
        {
            float res = 0;
            IList<SRVLoanDisburse> isrvdisburse = new LoanDAOLinq().getAllLoansLikeSerialID(serialid);
            if (isrvdisburse.Count != 0)
            {
                INVStockSerial invStockSerial = new SerialManager().GetSerialByID(serialid);
                SRVLoanDisburse srvLoanDisburse = new StockSerialNo().retLoanDisburse(isrvdisburse, serialid);
                int bagcount = new StockSerialNo().getbagcount(invStockSerial.SerialNo);


                return (float.Parse(srvLoanDisburse.LoanAmount.ToString())*bagcount);
            }
            else
                return 0;
        }
    }
}
